# -*- coding: UTF-8 -*-
import configparser,os
_env='dev'

current_directory = os.path.dirname(os.path.abspath(__file__))
#secret_file是不能上传gitlab的，所以要放在工作目录外
# config_file_env = {'dev': 'dev.ini', 'prod': 'prod.ini'}
class Secret:
    def __init__(self, env=_env):
        self.env=env
        secret_file = Config().get_secret_file_path()
        self.config = configparser.ConfigParser()
        self.config.read(secret_file, encoding='utf-8')

    def get_ipgSecret(self):
        return self.config['secret']['ipgSecret']

    def get_acSecret(self):
        return self.config['secret']['acSecret']

    def get_jenkinsSecret(self):
        return self.config['secret']['jenkinsSecret']

    def get_acAccessToken(self):
        return self.config['secret']['acAccessToken']

    def get_ipgAccessToken(self):
        return self.config['secret']['ipgAccessToken']

    def get_AC_dingdingSecret(self):
        return self.config['secret']['AC_dingdingSecret']

    def get_ipg_dingdingSecret(self):
        return self.config['secret']['ipg_dingdingSecret']

    def get_mqpass(self):
        print('get_mqpass==:',self.env,'================',_env)
        pass_name = 'mqpass_'+self.env
        return self.config['secret'][pass_name]

    def get_send_passwd_dd_appKey(self):
        return self.config['secret']['send_passwd_dd_appKey']

    def get_send_passwd_dd_app_secret(self):
        return self.config['secret']['send_passwd_dd_app_secret']

    def get_send_passwd_dd_robotCode(self):
        return self.config['secret']['send_passwd_dd_robotCode']

    def get_jenkins_secret(self):
        return self.config['secret']['jenkinsSecret']

class Config:
    def __init__(self, env=_env):
        self.config = configparser.ConfigParser()
        self.config.read(current_directory+'/config/'+env+'.ini', encoding='utf-8')

    def get_secret_file_path(self):
        return self.config['secret_file_path']['secret_file_path']

    def get_mq_it_user(self):
        return self.config['mq_it']['user']

    def get_mq_it_host(self):
        return self.config['mq_it']['host']

    def get_mq_it_port(self):
        return self.config['mq_it']['port']

    def get_mq_it_virtual_host(self):
        return self.config['mq_it']['virtual_host']

    def get_mq_it_queue(self):
        return self.config['mq_it']['queue']

    def get_mq_it_arguments(self):
        return self.config['mq_it']['arguments']

    def get_mq_danji_virtual_host(self):
        return self.config['mq_danji']['virtual_host']

    def get_mq_danji_queue(self):
        return self.config['mq_danji']['queue']

    def get_passw_file_path(self):
        return self.config['send_passwd']['passw_file_path']

    def get_flask_debug(self):
        return self.config['flask_server']['debug']



















if __name__ == "__main__":
    Secret()